package com.bigdata.model;/**
 * Created by Administrator on 2019/7/10 0010.
 */

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * @description
 * @date 2019/7/10 0010
 */
public class Result {
    public final static int Code_OK = 200;
    public final static int Code_Error = 500;
    private int code = Code_OK;
    private String message;
    private Object data;
    private List list;
    private Long total;
    private Long pages;

    public Long getPages() {
        return pages;
    }

    public void setPages(Long pages) {
        this.pages = pages;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public List getList() {
        return list;
    }

    public void setList(List list) {
        this.list = list;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public static Result ok() {
        Result res = new Result();
        return res;
    }

    public static Result ok(Object obj) {
        Result res = new Result();
        res.setData(obj);
        return res;
    }

    public static Result pageOk() {
        Result res = new Result();
        res.setList(new ArrayList());
        return res;
    }

    public static Result pageOk(List list) {
        Result res = new Result();
        res.setList(list);
        return res;
    }

    public static Result fail(String message) {
        Result res = new Result();
        res.setCode(Code_Error);
        res.setMessage(message);
        return res;
    }
}
